//package com.loooooo.card2023.utils;
//
//import com.teamdev.jxbrowser.browser.Browser;
//import com.teamdev.jxbrowser.engine.Engine;
//import com.teamdev.jxbrowser.engine.EngineOptions;
//import com.teamdev.jxbrowser.engine.RenderingMode;
//import com.teamdev.jxbrowser.ui.Bitmap;
//import com.teamdev.jxbrowser.view.graphics.BitmapImage;
//import java.awt.image.*;
//import java.io.File;
//import java.io.IOException;
//import java.net.MalformedURLException;
//import java.net.URL;
//import javax.imageio.ImageIO;
//
///**
// * An example of the JxBrowser launched without UI.
// */
//public final class ServerApplicationExample {
//
//    public static void main(String[] args) throws MalformedURLException {
//
//        File tmpl = new File("/data/card/nameplate.html");
//        File out = new File("/data/card/nameplate4.png");
//        Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.OFF_SCREEN).build());
//        Browser browser = engine.newBrowser();
//        browser.resize(1280, 1024);
//        URL url = tmpl.toURI().toURL();
//
//        browser.navigation().loadUrlAndWait(url.toString());
//
//
//
//        // The browser is up and running. Let's take a screenshot and check.
//        Bitmap bitmap = browser.bitmap();
//
//        BitmapImage bitmapImage = new BitmapImage<BufferedImage>(bitmap) {
//            @Override
//            protected BufferedImage createImage() {
//                return new BufferedImage(bitmap.size().width(),bitmap.size().height(),BufferedImage.TYPE_INT_ARGB);
//            }
//        };
//
////        BitmapImage<BufferedImage> bitmapImage = new BitmapImage<BufferedImage>(bitmap) {
////            @Override
////            protected BufferedImage createImage() {
////                return new BufferedImage(bitmap.size().width(),bitmap.size().height(),BufferedImage.TYPE_INT_ARGB);
////            }
////        };
//
//        BufferedImage image = (BufferedImage) bitmapImage.toolkitImage();
//        try {
//            ImageIO.write(image, "PNG", new File("screenshot.png"));
//        } catch (IOException e) {
//            System.out.println("Failed to save an image. " + e.getMessage());
//        }
//    }
//}